package com.gitee.simons.mybatis.mybatis;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/**
 * <p>
 * mybatisplus配置
 * </p>
 *
 * @author Simon
 * @since 2020-05-07
 */
@Configuration
@MapperScan(basePackages = "com.gitee.simons.*.mapper")
public class MybatisPlusConfig {

	/**
	 * 分页插件
	 * @return 分页对象
	 */
	@Bean
	public PaginationInterceptor paginationInterceptor() {
		return new PaginationInterceptor();
	}

	/**
	 * 乐观锁插件
	 * @return 乐观锁对象
	 */
	public OptimisticLockerInterceptor optimisticLockerInterceptor(){
		return new OptimisticLockerInterceptor();
	}

}
